<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" layout:decorate="main"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head>
    <title>用户修改</title>
    <link th:href="@{/localcss/crmlist.css}" href="../static/localcss/crmadd.css" rel="stylesheet">
</head>
<body>
<div layout:fragment="content">
    <div class="">
    <div class="clearfix"></div>
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
                <div class="x_title">
                    <h2>客户信息 <i class="fa fa-user"></i></h2>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content">
                    <div class="clearfix"></div>
                    <form class="form-horizontal form-label-left" th:action="@{/customer/save}" action="/chance/save" method="post">
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="custName"> 公司 <span class="required"></span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input type="hidden" name="custNo" th:value="${customer.custNo}"/>
                                <input id="custName" class="form-control col-md-7 col-xs-12"
                                       data-validate-length-range="10" data-validate-words="1" th:value="${customer.custName}" name="custName" required="required"
                                       placeholder="请输入客户名称" type="text" />
                            </div>
                        </div>

                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="custRegion"> 地区
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <select name="custRegion" id="custRegion" class="form-control" required="required">
                                    <option th:selected="${temp.dictValue eq customer.custRegion}" th:each="temp:${areas}"
                                            th:value="${temp.dictValue}" th:text="${temp.dictItem}" value="">地区
                                    </option>
                                </select>
                            </div>
                        </div>

                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="custManagerId"> 负责人
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <select name="custManagerId" id="custManagerId" class="form-control">
                                    <option value="0">--请选择--</option>
                                    <option th:selected="${user.usrId eq customer.custManagerId}"
                                            th:alt1="${user.usrId}"
                                            th:alt2="${customer.custManagerId}"

                                            th:each="user:${users}"
                                            th:value="${user.usrId}" th:text="${user.usrName}" value="">wuhu</option>
                                </select>
                            </div>
                        </div>


                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="custLevel"> 客户等级
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input type="hidden" name="custLevelLabel" th:value="${customer.custLevelLabel}" id="custLevelLabel"/>
                                <select name="custLevel" id="custLevel" class="form-control" onchange="onchangeValue(this)">
                                    <option value="0">--请选择--</option>
                                    <option th:selected="${temp.dictValue eq #strings.toString(customer.custLevel)}"
                                            th:each="temp:${customerLevel}"
                                            th:value="${temp.dictValue}" th:text="${temp.dictItem}" value="">wuhu</option>
                                </select>
                            </div>
                        </div>



                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-3">
                                <button id="send" type="submit" class="btn btn-success">保存</button>
                                <button type="button" class="btn btn-primary" id="back">返回</button>
                                <br/><br/>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</body>
<script layout:fragment="js">
    $(document).ready(function(){
        $("#back").on("click",function(){
            window.history.back();
        });
    });


    function onchangeValue(obj) {
        $("#custLevelLabel").val($(obj).find('option:selected').text());
    }


</script>
</html>